<?php
/* -------------------------------------------------------------------------------------
* 	ID:						$Id: logo_manager.php 64 2013-09-21 11:59:26Z phone.mueller@googlemail.com $
* 	Letzter Stand:			$Revision: 64 $
* 	zuletzt geaendert von:	$Author: siekiera $
* 	Datum:					$Date: 2013-09-21 11:59:26 +0000 (Sat, 21 Sep 2013) $
*
* 	SEO:mercari by Siekiera Media
* 	http://www.seo-mercari.de
*
* 	Copyright (c) since 2011 SEO:mercari
* --------------------------------------------------------------------------------------
* 	based on:
* 	(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
* 	(c) 2002-2003 osCommerce - www.oscommerce.com
* 	(c) 2003     nextcommerce - www.nextcommerce.org
* 	(c) 2005     xt:Commerce - www.xt-commerce.com
*
* 	Released under the GNU General Public License
* ----------------------------------------------------------------------------------- */

require('includes/application_top.php');

if(isset($_GET['action']) && $_GET['action'] == 'save_image') {
	if(isset($_POST['del_pic']) && $_POST['del_pic'] == 'yes') {
		if(@unlink(DIR_FS_CATALOG_IMAGES.$_POST['image_name']))
			$message_stack->add_session('Die Grafik '.$_POST['image_name'].' wurde erfolgreich gelöscht.', 'success');
		
	} else {
		if(try_upload('extra_image', DIR_FS_CATALOG_IMAGES, '777', '')){
			//Erfolgreich hochgeladen
		}
		else
			$message_stack->add_session('Die Grafik '.$_POST['image_name'].' konnte nicht gespeichert werden.<br />Stimmen die Verzeichnisrechte?', 'error');
	}
	redirect(href_link('logo_manager.php'));
}

function check_image($img) {
	if(file_exists(DIR_FS_CATALOG_IMAGES.$img)) {
		$size = getimagesize(DIR_FS_CATALOG_IMAGES.$img);
		return $size[1].'px x '.$size[0].'px';
	} else
		return false;
}

require(DIR_WS_INCLUDES.'metatag.php');
?>
</head>
<body>
<?php require(DIR_WS_INCLUDES.'header.php'); ?>
<div id="wrapper">
	<table class="outerTable" cellspacing="0" cellpadding="0">
		<tr>
			<td class="columnLeft2" width="<?php echo BOX_WIDTH; ?>" valign="top">
				<?php require(DIR_WS_INCLUDES.'column_left.php'); ?>
			</td>
			<td class="boxCenter" height="100%" valign="top">
	        	<table class="table_pageHeading" border="0" width="100%" cellspacing="0" cellpadding="0">
		   			<tr>
		     			<td class="pageHeading">Logo Manager</td>
					</tr>
				</table>
	        	<?php
	        		if(isset($_GET['type']))
	        			echo '<a class="button" href="?'.getMenuID('logo_manager').'">Übersicht</a> ';
	        		echo '<a class="button" href="?type=shop&'.getMenuID('logo_manager').'">Logo im Template</a> '; 
	        		echo '<a class="button" href="?type=email&'.getMenuID('logo_manager').'">Email Logo</a> ';
	        		echo '<a class="button" href="?type=fav_ico&'.getMenuID('logo_manager').'">Favicon (*.ico)</a> ';
	        		echo '<a class="button" href="?type=fav_png&'.getMenuID('logo_manager').'">Favicon (*.png)</a> ';
	        		echo '<a class="button" href="?type=ajax&'.getMenuID('logo_manager').'">Ajax Loader</a> ';	
	        		echo '<a class="button" href="?type=overlay&'.getMenuID('logo_manager').'">Overlay</a> ';
	        		echo '<a class="button" href="?type=pdf&'.getMenuID('logo_manager').'">PDF Logo</a> ';    			
	        	?>
	        	<br /><br />
	        	<?php if(isset($_GET['type'])) { 
	        		switch($_GET['type']) {
						case 'shop':
							$name = 'Logo des Templates';
							$img = 'shop_logo.jpg';
							$empf_size = 'Höhe 106px x Breite 990px';
							break;
							
						case 'email':
							$name = 'Email Logo';
							$img = 'email_logo.jpg';
							$empf_size = 'Höhe ca.100px x Breite ca.400px';
							break;
							
						case 'fav_ico':
							$name = 'Favicon des Shops (*.ico)';
							$img = 'favicon.ico';
							$empf_size = 'Höhe 16px x Breite 16px oder 32px x 32px';
							break;
							
						case 'fav_png':
							$name = 'Favicon des Shops (*.png)';
							$img = 'favicon.png';
							$empf_size = 'Höhe 16px x Breite 16px';
							break;
							
						case 'ajax':
							$name = 'Ajax Loader';
							$img = 'ajax_spinner.gif';
							$empf_size = 'Höhe 31px x Breite 31px';
							break;
							
						case 'overlay':
							$name = 'Overlay';
							$img = 'overlay.gif';
							$empf_size = 'beliebig';
							break;
							
						case 'pdf':
							$name = 'PDF Logo';
							$img = 'pdf_logo.jpg';
							$empf_size = 'ca. 300px';
							break;
					}
				echo draw_form('image', 'logo_manager.php', 'action=save_image', 'POST', 'enctype="multipart/form-data"');
	        	?>
		        	<table width="100%" cellpadding="5">
		        		<tr>
		        			<td valign="top" class="bb" width="1">
		        				<nobr><b><?php echo $name; ?></b></nobr>
		        			</td>
		        			<td class="bb">
		        				<?php
		        					if(check_image($img)) {
		        						echo '<img src="../images/'.$img.'" alt="" /><br /><br />';
		        						echo 'vorhandene Größe: '.check_image($img);
		        						echo draw_hidden_field('image_exists', 'true')."\n";
		        					} else
		        						echo '<em>noch nicht vorhanden</em><br />';
		        						
		        					echo draw_hidden_field('image_name', $img)."\n";
		        				?>
		        			</td>
		        		</tr>
		        		<tr>
		        			<td class="bb" valign="top">Grafik hochladen:</td>
		        			<td class="bb">
		        				<?php
		        					echo 'Die Empfohlene Größe ist: <b>'.$empf_size.'</b><br />';
		        					echo 'Der Name des Bildes muss: <b>'.$img.'</b> lauten<br /><br />';
		        					echo draw_file_field('extra_image').draw_hidden_field('type', $_GET['type']);
		        				?>
		        			</td>
		        		</tr>
		        		<tr>
		        			<td colspan="2">
		        				<button type="submit" class="button">
					        		<span class="button_disk-black"><?php echo BUTTON_SAVE; ?></span>
					        	</button>
		        			</td>
		        		</tr>
		        	</table>	
	        	</form>
	        	<?php } elseif(!isset($_GET['type'])) { ?>
	        	<table width="100%">
	        		<tr>
	        			<td><b>Header im Shop</b></td>
	        			<td><b>Email Logo</b></td>
	        			<td><b>Favicon *.ico</b></td>
	        			<td><b>Favicon *.png</b></td>
	        			<td><b>Ajax Loader</b></td>
	        			<td><b>Overlay</b></td>
	        			<td><b>PDF Logo</b></td>
	        		</tr>
	        		<tr>
	        			<td>
	        				<?php
	        					if(check_image('shop_logo.jpg'))
	        						echo '<img src="../images/shop_logo.jpg" alt="" width="150px" /><br /><br /><i>verkleinert</i>';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('email_logo.jpg'))
	        						echo '<img src="../images/email_logo.jpg" alt="" width="150px" /><br /><br /><i>verkleinert</i>';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('favicon.ico'))
	        						echo '<img src="../images/favicon.ico" alt="" />';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('favicon.png'))
	        						echo '<img src="../images/favicon.png" alt="" />';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('ajax_spinner.gif'))
	        						echo '<img src="../images/ajax_spinner.gif" alt="" />';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('overlay.gif'))
	        						echo '<img src="../images/overlay.gif" alt="" />';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        			<td>
	        				<?php
	        					if(check_image('pdf_logo.jpg'))
	        						echo '<img src="../images/pdf_logo.jpg" alt="" width="150px" /><br /><br /><i>verkleinert</i>';
	        					else
	        						echo '<em>noch nicht vorhanden</em>';
	        				?>
	        			</td>
	        		</tr>
	        	</table>
	        	<?php } ?>
		    </td>
		</tr>
	</table>
</div>
<?php require(DIR_WS_INCLUDES.'footer.php'); ?>
</body>
</html>
<?php require(DIR_WS_INCLUDES.'application_bottom.php'); ?>